package com.supermarket.config;



import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration
public class CommonConfig {

    /**
     * 通过knife4j生成接口文档
     */
    @Bean
    public Docket docket() {
        ApiInfo apiInfo = new ApiInfoBuilder()
                .title("超市管理系统项目接口文档")
                .version("1.0")
                .description("超市管理系统项目接口文档")
                .contact(new Contact(
                        "李斌,阳鑫,章万磊",    // 作者姓名
                        "https://www.supermarket.com",  // 作者网站链接（可选）
                        "author@libin.com"  // 作者电子邮件（可选）
                ))
                .build();

        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo)
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.supermarket.controller"))
                .paths(PathSelectors.any())
                .build();
    }







}